package com.example.iterator;

import com.example.iterator.Impi.CollectionArrayImpi;

/**
 * 迭代器模式
 */
public class Test {
    public static void main(String[] args) {
        CollectionArrayImpi collectionArrayImpi = new CollectionArrayImpi(new Object[]{1, 2, 3, 4, 5});

        Iterator iterator = collectionArrayImpi.getIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
